﻿function importJsFromLocal(args) {
    var path = args['path'];
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = chrome.runtime.getURL(path);
    (document.head || document.documentElement).appendChild(script);
}

function importJsByJsCodeString(args) {
    var jsCode = args['jsCode'];
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.innerHTML = jsCode;
    (window.document.head || window.document.documentElement).appendChild(script);
}

importJsFromLocal({'path': 'lib/live2D/L2Dwidget.min.js'});
importJsFromLocal({'path': 'lib/live2D/initKbn.js'});
importJsByJsCodeString({'jsCode': "window.kbnRootPath=\'" + chrome.runtime.getURL("") + "\';"});
